package com.sl.ecm.backup.constant;

/**
 * 数据库备份与还原命令
 */
public class DbCommand {

    /**
     * mysql备份命令
     */
    public static final String MYSQL_BACKUP = "mysqldump --column-statistics=0 -h{} -P{} -u{} -p{} {} > {} --default-character-set=utf8mb4 --verbose";

    /**
     * mysql还原命令
     */
    public static final String MYSQL_RESTORE = "mysql -h{} -P{} -u{} -p{} {} < {} --default-character-set=utf8mb4 --verbose";

    /**
     * postgresql备份命令
     */
    public static final String POSTGRESQL_BACKUP = "pg_dump -h {} -p {} -U {} -d {} > {} -c --if-exists";

    /**
     * postgresql还原命令
     */
    public static final String POSTGRESQL_RESTORE = "psql -h {} -p {} -U {} -d {} -f {}";

    /**
     * sqlserver备份命令
     */
    public static final String SQLSERVER_BACKUP = "sqlcmd -S {},{} -U {} -P {} -Q \"BACKUP DATABASE {} TO DISK = '{}' WITH INIT\"";

    /**
     * sqlserver还原命令
     */
    public static final String SQLSERVER_RESTORE = "sqlcmd -S {},{} -U {} -P {} -Q \"RESTORE DATABASE {} FROM DISK = '{}'\"";

    /**
     * 达梦 备份命令
     */                                          //user/password@host:port dbname
    public static final String DMS_BACKUP = "dexp USERID={}/{}@{}:{} SCHEMAS={} FILE={} LOG={} DIRECTORY={}";

    /**
     * 达梦 还原命令
     */
    public static final String DMS_RESTORE = "dimp USERID={}/{}@{}:{} SCHEMAS={} FILE={} LOG={} DIRECTORY={} TABLE_EXISTS_ACTION=REPLACE";
}

